package com.yfbao.horizon.inspection.controller;

import com.yfbao.horizon.inspection.prometheus.PrometheusQueryService;
import com.yfbao.horizon.inspection.prometheus.PrometheusResponse;
import com.yfbao.horizon.inspection.prometheus.MetricsResponseDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/prometheus")
@Slf4j
public class PrometheusController {

    @Autowired
    private PrometheusQueryService queryService;



    @GetMapping("/tag/v8")
    public ResponseEntity<MetricsResponseDto> checkv8Index() {

        MetricsResponseDto prometheusTableDto = queryService.testCheckAppIndex();

        return ResponseEntity.ok(prometheusTableDto);
    }


    private PrometheusResponse createErrorResponse(String error) {
        PrometheusResponse response = new PrometheusResponse();
        response.setStatus("error");
        response.setError(error);
        return response;
    }
}


